import ELEMENT from "element-ui"
const req = require.context('element-ui/lib/utils', true, /\.js$/)

let utils = {}
req.keys().filter(i => {
  if (i.startsWith('./')) {
    return true
  }
  return false
}).map(i => {
  let item = [i]
  item.push(req(i))
  i = i.replace('.js', '')
    .replace('./', '')
    .replace(/[-|/]([a-z])/g, ($0, $1) => {
      return $1.toUpperCase()
    })
  item.push(i)
  return item
}).forEach(key => {
  utils[key[2]] = key[1]
})

ELEMENT.utils = utils

if (window.Vue) {
  ELEMENT.install(window.Vue)
}

export default ELEMENT
